import sqlite3

sql = 'SELECT * from t1 ORDER BY id ASC'

conn = sqlite3.connect('test.db')
cursor = conn.cursor()

results = cursor.execute(sql)

all_ = results.fetchall()

with open('jk.txt', 'w', encoding='utf8') as f:
    for item in all_:
        f.write(item[1])
        f.write('\n')
        f.write(item[2])
